package com.yangwudi.utils;

import com.yangwudi.pojo.Clazz;

import java.time.LocalDate;

public class ClazzStatusUtils {
    public static String computeStatus(Clazz clazz) {
        LocalDate now = LocalDate.now();
        if (clazz.getEndDate() != null && now.isAfter(clazz.getEndDate())) {
            return "已结课";
        } else if (clazz.getBeginDate() != null && now.isBefore(clazz.getBeginDate())) {
            return "未开班";
        } else if (clazz.getBeginDate() != null) {
            return "在读中";
        } else {
            return "状态未知";
        }
    }
}
